import 'package:flutter/material.dart';
import 'package:im_flutter_sdk_example/utils/screen.dart';

class Captcha extends StatefulWidget {
  @override
  _CaptchaState createState() => _CaptchaState();
}

class _CaptchaState extends State<Captcha> {
  int timestamp = 0;
  _refreshCaptcha() {
    timestamp = DateTime.now().microsecond;
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: GestureDetector(
        onTap: _refreshCaptcha,
        child: Container(
          child: Image.network(
              "https://kjcg.casjn.cn/pro/captcha.jpg?t=$timestamp",
              width: 200.w,
              height: 56.h,
              fit: BoxFit.contain),
        ),
      ),
    );
  }
}
